<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="jt" uri="http://www.jsoft.org/tags/jsoft"%>
<%@ taglib prefix="jh" uri="http://www.jsoft.org/tags/jsoft-html"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	if(path!=null&&path.equals("/")){
	   path="";
	} 
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
	<head>
		<title>网站信息文章列表</title>
		<link href="<%=basePath%>admin/styles/default.css" rel="stylesheet"
			type="text/css" />
		<link href="<%=basePath%>admin/styles/page.css" rel="stylesheet"
			type="text/css" />
		<script type="text/javascript">
		function form_delete(href)
		{
			if(confirm("您确定要删除吗？执行删除后数据将无法恢复！"))
			{
   				window.location.href = href;
   			}
		}
		</script>
	</head>

	<body>
		<div class="title">
			<h2>
				网站信息文章列表
			</h2>
		</div>
		<div id="container">
			<!-- table -->
			<div id="info">
				<form action="<%=basePath%>manager/news/list.do" method="post">
					<table width="100%" cellpadding="3" cellspacing="1" border="0" bgcolor="#e3e3e3">
						<tr bgcolor="#FFFFFF">
							<td width="100" nowrap="nowrap" bgcolor="#f7fbff">类目</td>
							<td>
								<select name="classid">
									<option value="">-请选择-</option>
									<c:forEach items="${requestScope.categorys}" var="category">
									<c:if test="${category.pid eq 0}">
									<option value="${category.id}" ${(requestScope.query.classid eq category.id)?'selected=selected':''}><c:out value="${category.name}"/></option>
									<c:forEach items="${requestScope.categorys}" var="cate_1">
									<c:if test="${cate_1.pid eq category.id}">
									<option value="${cate_1.id}" ${(requestScope.query.classid eq cate_1.id)?'selected=selected':''}>|-<c:out value="${cate_1.name}"/></option>
									<c:forEach items="${requestScope.categorys}" var="cate_2">
									<c:if test="${cate_2.pid eq cate_1.id}">
									<option value="${cate_2.id}" ${(requestScope.query.classid eq cate_2.id)?'selected=selected':''}>　|-<c:out value="${cate_2.name}"/></option>
									<c:forEach items="${requestScope.categorys}" var="cate_3">
									<c:if test="${cate_3.pid eq cate_2.id}">
									<option value="${cate_3.id}" ${(requestScope.query.classid eq cate_3.id)?'selected=selected':''}>　　|-<c:out value="${cate_3.name}"/></option>
									</c:if>
									</c:forEach>
									</c:if>
									</c:forEach>
									</c:if>
									</c:forEach>
									</c:if>
									</c:forEach>
								</select>
							</td>
							<td width="100" nowrap="nowrap" bgcolor="#f7fbff">标题</td>
							<td>
								<input type="text" name="title" value="${requestScope.query.title}" size="40" class="text" />
							</td>
							<td colspan="2" nowrap="nowrap">
								<input type="submit" value="查询" class="button" />
								<input type="button" value="新增" class="button" onclick="window.location.href='<%=basePath%>manager/news/create.do';" />
								<input type="hidden" name="page" value="${requestScope.PAGEMODEL.pageNum}"/>
							</td>
						</tr>
					</table>
				</form>
				<div style="height: 10px;"></div>
			</div>
			<table class="table01">
				<tr>
					<th>编号</th>
					<th>标题</th>
					<th>发布时间</th>
					<th>创建时间</th>
					<th>状态</th>
					<th width="70">操作</th>
				</tr>
				<c:forEach items="${requestScope.newsList}" var="news">
				<tr>
					<td><c:out value="${news.id}"/></td>
					<td><c:out value="${news.title}"/></td>
					<td nowrap="nowrap"><jt:date date="${news.addtime}" format="yyyy-MM-dd"/></td>
					<td nowrap="nowrap"><jt:date date="${news.createTime}" format="yyyy-MM-dd"/></td>
					<td>
						<c:if test="${news.state eq 1}"><font color="blue">有效</font></c:if>
						<c:if test="${news.state eq 0}"><font color="red">无效</font></c:if>
						(<c:out value="${news.state}"/>)
					</td>
					<td>
						<a href="<%=basePath%>manager/news/edit.do?id=${news.id}">修改</a>
						<a href="javascript:form_delete('<%=basePath%>manager/news/delete.do?id=${news.id}');">删除</a>
					</td>
				</tr>
				</c:forEach>
			</table>
			<jt:page/>
		</div>
	</body>
</html>
